#include <bits/stdc++.h>
using namespace std;

struct list_node
{
    int val;
    struct list_node *next;
};

list_node *input_list(void)
{
    int n, val;
    list_node *phead = new list_node();
    list_node *cur_pnode = phead;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &val);
        if (i == 1)
        {
            cur_pnode->val = val;
            cur_pnode->next = NULL;
        }
        else
        {
            list_node *new_pnode = new list_node();
            new_pnode->val = val;
            new_pnode->next = NULL;
            cur_pnode->next = new_pnode;
            cur_pnode = new_pnode;
        }
    }
    return phead;
}

list_node *reverse_list(list_node *head, int L, int R)
{
    list_node *begin = head, *end = head;
    int l = L - 1, r = R;
    while (--l > 0)
    {
        begin = begin->next;
    }
    while (r--)
    {
        end = end->next;
    }

    list_node *cur;
    if (L == 1)
    {
        cur = head;
    }
    else
    {
        cur = begin->next;
    }
    list_node *pre = end;
    while (cur->next != end)
    {
        list_node *next = cur->next;
        cur->next = pre;
        pre = cur;
        cur = next;
    }
    cur->next = pre;
    if (L == 1)
    {
        head = cur;
    }
    else
    {
        begin->next = cur;
    }
    return head;
}

void print_list(list_node *head)
{
    while (head != NULL)
    {
        printf("%d ", head->val);
        head = head->next;
    }
    puts("");
}

int main()
{
    int L, R;
    list_node *head = input_list();
    scanf("%d%d", &L, &R);
    list_node *new_head = reverse_list(head, L, R);
    print_list(new_head);
    return 0;
}